package com.acwing.partition12;

import java.io.*;
import java.util.Arrays;

/**
 * @author `RKC`
 * @date 2022/1/19 9:46
 */
public class AC1145北极通讯网络 {

    private static final int N = 510, M = N * N / 2;
    private static int[][] points = new int[M][2];
    private static int[] parent = new int[N];
    private static Edge[] edges = new Edge[M];

    private static int n = 0, k = 0, cnt = 0;

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        String[] s = reader.readLine().split("\\s+");
        n = Integer.parseInt(s[0]);
        k = Integer.parseInt(s[1]);
        for (int i = 0; i < n; i++) {
            s = reader.readLine().split("\\s+");
            points[i] = new int[]{Integer.parseInt(s[0]), Integer.parseInt(s[1])};
        }
        init();
        writer.write(String.format("%.2f\n", kruskal()));
        writer.flush();
    }

    private static void init() {
        //初始化并查集数组和创建所有边
        for (int i = 0; i < parent.length; i++) parent[i] = i;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < i; j++) {
                int[] p1 = points[i], p2 = points[j];
                edges[cnt++] = new Edge(i, j, getDist(p1, p2));
            }
        }
    }

    private static double kruskal() {
        Arrays.sort(edges, 0, cnt, (o1, o2) -> Double.compare(o1.w, o2.w));
        int block = n;
        double answer = 0;
        for (int i = 0; i < cnt; i++) {
            if (block <= k) break;
            int u = edges[i].u, v = edges[i].v, a = find(u), b = find(v);
            if (a != b) {
                parent[b] = a;
                //每进行一次union操作，连通块数量都会少1
                block--;
                answer = edges[i].w;
            }
        }
        return answer;
    }

    private static int find(int x) {
        if (x == parent[x]) return x;
        return parent[x] = find(parent[x]);
    }

    private static double getDist(int[] p1, int[] p2) {
        int x = p1[0] - p2[0], y = p1[1] - p2[1];
        return Math.sqrt(x * x + y * y);
    }

    private static class Edge {
        private int u;
        private int v;
        private double w;

        public Edge(int u, int v, double w) {
            this.u = u;
            this.v = v;
            this.w = w;
        }
    }
}
